package common

import (
	"fmt"
	"sync"
)

// 定义一个仅内部可以访问的局部变量
var (
	cacheMap = make(map[string]string)
	mutex    sync.Mutex
)

func AddToCache(key, value string) {
	mutex.Lock()
	defer mutex.Unlock()
	cacheMap[key] = value
}

func GetFromCache(key string) string {
	return cacheMap[key]
}

func CacheString() {
	fmt.Println(cacheMap)
}
